home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / tex / tex31 / texsrc.lzh / COMMON.LZH / MAIN.C < prev    next >
C/C++ Source or Header  |  1991-01-13  |  999b  |  51 lines

  1. /* main.c -- the usual main program.  */
  2.  
  3. #include "extra.h"
  4.  
  5.  
  6. /* The command line is stored here, since Pascal has usurped `argv' 
  7.    for a procedure.  */
  8. static char **gargv;
  9.  
  10. /* Referenced from the Pascal, so not static.  */
  11. integer argc;
  12.  
  13. #ifdef atarist
  14. int _stksize = -1L;
  15. #endif
  16.  
  17. /* The entry point for all the programs except TeX and Metafont, which
  18.    have more to do.  We just have to set up the command line.  Pascal's
  19.    main block is transformed into the procedure `main_body'.  */
  20.  
  21. void
  22. main (ac, av)
  23.   int ac;
  24.   char **av;
  25. {
  26.   argc = ac;
  27.   gargv = av;
  28. #ifdef atarist
  29.   if (!getenv ("UNIXMODE"))
  30.     _set_unixmode ("dr/");
  31.   _binmode (1);            /* Make sure to open all files in */
  32.                 /* binary mode */
  33. #endif
  34.   main_body ();
  35.   exit (0);
  36. }
  37.  
  38.  
  39. /* Read the Nth argument from the command line.  BUF is a Pascal
  40.    string, i.e., it starts at index 1 and ends with a space.  */
  41.  
  42. void
  43. argv (n, buf)
  44.   int n;
  45.   char buf[];
  46. {
  47.   (void) strcpy (buf + 1, gargv[n]);
  48.   (void) strcat (buf + 1, " ");
  49. }
  50.  
  51.